home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / mac / tkMacPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  3.5 KB  |  146 lines  |  [TEXT/CWIE]

  1. /*
  2.  * tkMacPort.h --
  3.  *
  4.  *    This file is included by all of the Tk C files.  It contains
  5.  *    information that may be configuration-dependent, such as
  6.  *    #includes for system include files and a few other things.
  7.  *
  8.  * Copyright (c) 1994-1996 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkMacPort.h 1.52 97/07/28 11:18:59
  14.  */
  15.  
  16. #ifndef _TKMACPORT
  17. #define _TKMACPORT
  18.  
  19. /*
  20.  * Macro to use instead of "void" for arguments that must have
  21.  * type "void *" in ANSI C;  maps them to type "char *" in
  22.  * non-ANSI systems.  This macro may be used in some of the include
  23.  * files below, which is why it is defined here.
  24.  */
  25.  
  26. #ifndef VOID
  27. #   ifdef __STDC__
  28. #       define VOID void
  29. #   else
  30. #       define VOID char
  31. #   endif
  32. #endif
  33.  
  34. #ifndef _TCL
  35. #   include <tcl.h>
  36. #endif
  37.  
  38. #include <time.h>
  39. #include <stdlib.h>
  40. #include <string.h>
  41. #include "tclMath.h"
  42. #include <ctype.h>
  43. #include <limits.h>
  44.  
  45. #include <Xlib.h>
  46. #include <cursorfont.h>
  47. #include <keysym.h>
  48. #include <Xatom.h>
  49. #include <Xfuncproto.h>
  50. #include <Xutil.h>
  51.  
  52. /*
  53.  * Not all systems declare the errno variable in errno.h. so this
  54.  * file does it explicitly.
  55.  */
  56.  
  57. extern int errno;
  58.  
  59. /*
  60.  * Define "NBBY" (number of bits per byte) if it's not already defined.
  61.  */
  62.  
  63. #ifndef NBBY
  64. #   define NBBY 8
  65. #endif
  66.  
  67. /*
  68.  * Declarations for various library procedures that may not be declared
  69.  * in any other header file.
  70.  */
  71.  
  72. extern void         panic  _ANSI_ARGS_(TCL_VARARGS(char *, string));
  73. extern int        strcasecmp _ANSI_ARGS_((CONST char *s1,
  74.                 CONST char *s2));
  75. extern int        strncasecmp _ANSI_ARGS_((CONST char *s1,
  76.                 CONST char *s2, size_t n));
  77.  
  78. /*
  79.  * Defines for X functions that are used by Tk but are treated as
  80.  * no-op functions on the Macintosh.
  81.  */
  82.  
  83. #define XFlush(display)
  84. #define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
  85. #define XGrabServer(display)
  86. #define XNoOp(display) {display->request++;}
  87. #define XUngrabServer(display)
  88. #define XSynchronize(display, bool) {display->request++;}
  89. #define XSync(display, bool) {display->request++;}
  90. #define XVisualIDFromVisual(visual) (visual->visualid)
  91.  
  92. /*
  93.  * The following functions are not used on the Mac, so we stub it out.
  94.  */
  95.  
  96. #define TkFreeWindowId(dispPtr,w)
  97. #define TkInitXId(dispPtr)
  98. #define TkpCmapStressed(tkwin,colormap) (0)
  99. #define TkpFreeColor(tkColPtr)
  100. #define TkSetPixmapColormap(p,c) {}
  101. #define Tk_FreeXId(display,xid)
  102. #define TkpSync(display)
  103.  
  104. /*
  105.  * The following macro returns the pixel value that corresponds to the
  106.  * RGB values in the given XColor structure.
  107.  */
  108.  
  109. #define PIXEL_MAGIC ((unsigned char) 0x69)
  110. #define TkpGetPixel(p) ((((((PIXEL_MAGIC << 8) \
  111.     | (((p)->red >> 8) & 0xff)) << 8) \
  112.     | (((p)->green >> 8) & 0xff)) << 8) \
  113.     | (((p)->blue >> 8) & 0xff))
  114.  
  115. /*
  116.  * This macro stores a representation of the window handle in a string.
  117.  */
  118.  
  119. #define TkpPrintWindowId(buf,w) \
  120.     sprintf((buf), "0x%x", (unsigned int) (w))
  121.         
  122. /*
  123.  * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
  124.  */
  125.  
  126. #define TkpScanWindowId(i,s,wp) \
  127.     Tcl_GetInt((i),(s),(wp))
  128.  
  129. /*
  130.  * Magic pixel values for dynamic (or active) colors.
  131.  */
  132.  
  133. #define HIGHLIGHT_PIXEL            31
  134. #define HIGHLIGHT_TEXT_PIXEL        33
  135. #define CONTROL_TEXT_PIXEL        35
  136. #define CONTROL_BODY_PIXEL        37
  137. #define CONTROL_FRAME_PIXEL        39
  138. #define WINDOW_BODY_PIXEL        41
  139. #define MENU_ACTIVE_PIXEL        43
  140. #define MENU_ACTIVE_TEXT_PIXEL        45
  141. #define MENU_BACKGROUND_PIXEL        47
  142. #define MENU_DISABLED_PIXEL        49
  143. #define MENU_TEXT_PIXEL            51
  144.  
  145. #endif /* _TKMACPORT */
  146.